package com.example.demo.vo

import com.example.demo.dao.TFoodDao
import com.example.demo.dao.TFoodTypeDao
import io.swagger.annotations.ApiModelProperty
import me.liuwj.ktorm.dsl.QueryRowSet

class FoodInfoVo {

    @ApiModelProperty(value = "id")
    var id: Int? = null

    @ApiModelProperty(value = "菜品名称")
    var title: String? = null

    @ApiModelProperty(value = "图片url")
    var url: String? = null

    @ApiModelProperty(value = "价格")
    var price: Double? = null

    @ApiModelProperty(value = "销量")
    var sales: Int? = null

    @ApiModelProperty(value = "菜品简介")
    var Introduction: String? = null

    @ApiModelProperty(value = "规格")
    var specification: String? = null

    @ApiModelProperty(value = "菜品id")
    var foodTypeId: Int? = null

    @ApiModelProperty("菜品类型名称")
    var foodTypeTitle: String? = null

    fun getVo(queue: QueryRowSet): FoodInfoVo {
        queue.let {
            val foodInfo = FoodInfoVo()
            foodInfo.id = it[TFoodDao.id]
            foodInfo.url = it[TFoodDao.url]
            foodInfo.title = it[TFoodDao.title]
            foodInfo.specification = it[TFoodDao.specification]
            foodInfo.sales = it[TFoodDao.sales]
            foodInfo.price = it[TFoodDao.price]
            foodInfo.foodTypeId = it[TFoodDao.foodTypeId]
            foodInfo.foodTypeTitle = it[TFoodTypeDao.title]
            foodInfo.Introduction = it[TFoodDao.Introduction]
            return foodInfo
        }
    }


}